<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='ttblsjxt'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
    <style>
        html {
            background: #fff;
        }
    </style>
</head>

<body>
<div class="layui-container">
    <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

        <form:form commandName="goods" method="${_method }" class="layui-form" id="form">
            <input type="hidden" name="_method" value="${_method }"/>
            <form:hidden path="id"/>

            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend><fmt:message key='jbxx'/></legend>
            </fieldset>


            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='spmc'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.name}
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='spbh'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.goodsNo}
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='spjg'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.defaultPrice}
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='scj'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.marketPrice}
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='ptjg'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.groupBookingPrice}
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='ctrs'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.groupBookingCondition}
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='djzfsj'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.groupBookingBeginTime} ~ ${goods.groupBookingEndTime}
                </div>
            </div>

<%--            <div class="layui-form-item">--%>
<%--                <label class="layui-form-label"> 限购数量</label>--%>
<%--                <div class="layui-form-mid layui-word-aux">--%>
<%--                        ${goods.groupBookingLimit}--%>
<%--                </div>--%>
<%--            </div>--%>


            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend><fmt:message key='spgg'/></legend>
            </fieldset>

            <div class="layui-form-item attributeArea">
                <label class="layui-form-label"> <fmt:message key='spsku'/></label>
                <div class="layui-input-block">
                    <table class="layui-table" lay-size="sm" id="feijin-sku-table">
                        <thead>
                        <th><fmt:message key='gg'/></th>
                        <th><fmt:message key='bh'/></th>
                        <th><fmt:message key='kc'/></th>
                        <th><fmt:message key='xsj'/></th>

                        <th><fmt:message key='ptjg'/></th>
                        <th><fmt:message key='ptkc'/></th>

                        </thead>
                        <tbody>



                            <c:forEach items="${goods.skus}" var="sku" varStatus="index">

                                <tr>
                                    <td>${sku.skuNames}</td>
                                    <td>${sku.code}</td>
                                    <td>${sku.store}</td>
                                    <td>${sku.price}</td>

                                    <td>${sku.groupBookingPrice}</td>
                                    <td>${sku.groupBookingStore}</td>

                                </tr>
                            </c:forEach>

                        </tbody>
                    </table>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><b style="color:red">*</b> <fmt:message key='shjg'/></label>
                <div class="layui-input-inline" style="width:70%;">
                    <input type="radio" name="groupBookingStatus" lay-filter="groupBookingStatus" lay-verify="required" value="3" title="<fmt:message key='shtgptyg'/>" <c:if test="${goods.groupBookingStatus eq 3}">checked="checked"</c:if>/>
                    <%--<input type="radio" name="groupBookingStatus" lay-filter="groupBookingStatus" lay-verify="required" value="5" title="审核通过并开始活动（开发使用）" <c:if test="${goods.groupBookingStatus eq 5}">checked="checked"</c:if>/>--%>
                    <input type="radio" name="groupBookingStatus" lay-filter="groupBookingStatus" lay-verify="required" value="4" title="<fmt:message key='shbtg'/>" <c:if test="${goods.groupBookingStatus eq 4}">checked="checked"</c:if>/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='shbz'/></label>
                <div class="layui-input-inline" style="width:80%;">
                    <form:textarea path="checkNote" class="layui-textarea" style="height:100px;width:100%"/>
                </div>
            </div>

            <div class="layui-input-block">
                <div style="display: none"><input type="button" value="<fmt:message key='bc'/>" class="layui-btn" id="submit" lay-filter="submit" lay-submit></div>
            </div>

        </form:form>
    </div>
</div>

<div style="display:none;">

</div>


<script>

    $(function () {

        layui.use(['form', 'laydate'], function () {

            var form = layui.form;
            var laydate = layui.laydate;

            form.on('submit(submit)', function (data) {

                var mainType = $(":radio[name='groupBookingStatus']:checked").val();

                if (!mainType) {
                    layui.use('layer', function () {
                        layer.msg("<fmt:message key='qxzshzt'/>");
                    });

                    return false;
                }

                $("#form").ajaxSubmit({
                    success: function (result) {
                        if (result.status) {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.$("#search").click();
                        } else {
                            layer.alert(result.message);
                        }
                    }
                });
            });

        });

    });
</script>
</body>
</fmt:bundle>
</html>